package com.stone.serverless.web;

import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.context.annotation.ClassPathBeanDefinitionScanner;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;

/**
 * @Description: TODO
 * @Author: MECHREVO
 * @Date: 2022/1/18 18:54
 * @Version: 1.0.0
 */
public class ServerlessWebContext extends AnnotationConfigWebApplicationContext {

    @Override
    protected ClassPathBeanDefinitionScanner getClassPathBeanDefinitionScanner(DefaultListableBeanFactory beanFactory) {
        ClassPathBeanDefinitionScanner classPathBeanDefinitionScanner = new ClassPathBeanDefinitionScanner(beanFactory, true, getEnvironment());
        classPathBeanDefinitionScanner.setResourceLoader( new PathMatchingResourcePatternResolver(this.getClassLoader()));
        return classPathBeanDefinitionScanner;
    }

}
